using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class TraCuu : System.Web.UI.MasterPage
{
    clsxuly xuly = new clsxuly();
    DataTable tbl = new DataTable();
    SqlDataAdapter dr = new SqlDataAdapter();
    protected void Page_Load(object sender, EventArgs e)
    {
        TaoCay();
    }
    private void TaoCay()
    {
        tvtheloaisach.Nodes.Clear();
        TreeNode Goc = new TreeNode();
        // Goc = new TreeNode("Thể Loại");
        tbl = xuly.LayTheLoai();
        // string tentheloai = "";
        string matheloai = "";
        foreach (DataRow dr in tbl.Rows)
        {
            Goc = new TreeNode();
            matheloai = dr["MaTL"].ToString();
            Goc.Text = dr["TenTL"].ToString();
            Goc.NavigateUrl = "Tracuu.aspx?ma=" + matheloai;
            tvtheloaisach.Nodes.Add(Goc);
        }
    }
    protected void tvtheloaisach_SelectedNodeChanged(object sender, EventArgs e)
    {
        Response.Redirect(tvtheloaisach.SelectedNode.NavigateUrl);
    }
}
